<?php


namespace App\Admin\Forms\Settings;


use Illuminate\Http\Request;
use function app\Helpers\sys;

class Company extends BaseTabForm
{
    /**
     * The form title.
     *
     * @var string
     */
    public $title = '公司信息';

    /**
     * Handle the form request.
     *
     * @param Request $request
     *
     * @return \Illuminate\Http\RedirectResponse
     */
    public function handle(Request $request)
    {
        parent::handle($request);

        admin_success('Processed successfully.');

        return back();
    }

    /**
     * Build a form here.
     */
    public function form()
    {
        $this->text('company_name', '企业名称')->rules('required');
        $this->text('company_people', '企业法人')->rules('required');
//        $this->text('phone', '联系电话')->rules('required');
        $this->text('company_address', '联系地址')->rules('required');
//        $this->text('ems_code', '邮政编码')->rules('required');
//        $this->text('email', '电子邮箱')->rules('required|email')->help('电子邮箱');
//        $this->text('company_webset', '企业网址')->rules('required|url')->help('企业网址');
        $this->text('company_detail', '企业介绍')->rules('required');
    }

    /**
     * The data of the form.
     *
     * @return array $data
     */
    public function data()
    {
        return [
            'company_name' => sys('company_name'),
            'company_people' => sys('company_people'),
//            'phone'  => sys('phone'),
            'company_address' => sys('company_address'),
//            'ems_code'    => sys('ems_code'),
//            'email'   => sys('email'),
//            'company_webset' => sys('company_webset'),
            'company_detail' => sys('company_detail'),
        ];
    }
}
